/*
 * User.java
 * 
 * Created on 19-jun-2007, 20:51:26
 * 
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.i2a.peacsy.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Tortuga
 */
@Entity
@Table(name = "TA_USER_USERS")
@NamedQueries({@NamedQuery(name = "User.findByUserCoCode", query = "SELECT u FROM User u WHERE u.userCoCode = :userCoCode"), @NamedQuery(name = "User.findByUserLiLogin", query = "SELECT u FROM User u WHERE u.userLiLogin = :userLiLogin"), @NamedQuery(name = "User.findByUserLiPassword", query = "SELECT u FROM User u WHERE u.userLiPassword = :userLiPassword"), @NamedQuery(name = "User.findByAudiInSituation", query = "SELECT u FROM User u WHERE u.audiInSituation = :audiInSituation"), @NamedQuery(name = "User.findByAudiDaCreationDate", query = "SELECT u FROM User u WHERE u.audiDaCreationDate = :audiDaCreationDate"), @NamedQuery(name = "User.findByAudiLiCreationUsr", query = "SELECT u FROM User u WHERE u.audiLiCreationUsr = :audiLiCreationUsr"), @NamedQuery(name = "User.findByAudiDaUpdateDate", query = "SELECT u FROM User u WHERE u.audiDaUpdateDate = :audiDaUpdateDate"), @NamedQuery(name = "User.findByAudiLiUpdateUsr", query = "SELECT u FROM User u WHERE u.audiLiUpdateUsr = :audiLiUpdateUsr")})
public class User implements Serializable {

  @Id
  @Column(name = "USER_CO_CODE", nullable = false)
  private Integer userCoCode;

  @Column(name = "USER_LI_LOGIN")
  private String userLiLogin;

  @Column(name = "USER_LI_PASSWORD")
  private String userLiPassword;

  @Column(name = "AUDI_IN_SITUATION")
  private Short audiInSituation;

  @Column(name = "AUDI_DA_CREATION_DATE")
  @Temporal(TemporalType.TIMESTAMP)
  private Date audiDaCreationDate;

  @Column(name = "AUDI_LI_CREATION_USR")
  private String audiLiCreationUsr;

  @Column(name = "AUDI_DA_UPDATE_DATE")
  @Temporal(TemporalType.TIMESTAMP)
  private Date audiDaUpdateDate;

  @Column(name = "AUDI_LI_UPDATE_USR")
  private String audiLiUpdateUsr;

  @JoinColumn(name = "PERS_CO_CODE", referencedColumnName = "PERS_CO_CODE")
  @ManyToOne
  private Person persCoCode;
    protected static org.apache.commons.logging.Log
        log = org.apache.commons.logging.LogFactory.getLog(User.class);

    public User() {
    }

  public User(Integer userCoCode) {
    this.userCoCode = userCoCode;
  }

  public Integer getUserCoCode() {
    return userCoCode;
  }

  public void setUserCoCode(Integer userCoCode) {
    this.userCoCode = userCoCode;
  }

  public String getUserLiLogin() {
    return userLiLogin;
  }

  public void setUserLiLogin(String userLiLogin) {
    this.userLiLogin = userLiLogin;
  }

  public String getUserLiPassword() {
    return userLiPassword;
  }

  public void setUserLiPassword(String userLiPassword) {
    this.userLiPassword = userLiPassword;
  }

  public Short getAudiInSituation() {
    return audiInSituation;
  }

  public void setAudiInSituation(Short audiInSituation) {
    this.audiInSituation = audiInSituation;
  }

  public Date getAudiDaCreationDate() {
    return audiDaCreationDate;
  }

  public void setAudiDaCreationDate(Date audiDaCreationDate) {
    this.audiDaCreationDate = audiDaCreationDate;
  }

  public String getAudiLiCreationUsr() {
    return audiLiCreationUsr;
  }

  public void setAudiLiCreationUsr(String audiLiCreationUsr) {
    this.audiLiCreationUsr = audiLiCreationUsr;
  }

  public Date getAudiDaUpdateDate() {
    return audiDaUpdateDate;
  }

  public void setAudiDaUpdateDate(Date audiDaUpdateDate) {
    this.audiDaUpdateDate = audiDaUpdateDate;
  }

  public String getAudiLiUpdateUsr() {
    return audiLiUpdateUsr;
  }

  public void setAudiLiUpdateUsr(String audiLiUpdateUsr) {
    this.audiLiUpdateUsr = audiLiUpdateUsr;
  }

  public Person getPersCoCode() {
    return persCoCode;
  }

  public void setPersCoCode(Person persCoCode) {
    this.persCoCode = persCoCode;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (userCoCode != null ? userCoCode.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof User)) {
      return false;
    }
    User other = (User) object;
    if (this.userCoCode != other.userCoCode && (this.userCoCode == null || !this.userCoCode.equals(other.userCoCode))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "org.i2a.peacsy.entity.User[userCoCode=" + userCoCode + "]";
  }

}
